package com.linchong.concurrency.chapter8;

/**
 * @Author:linchong
 * @CreateTime:2020-01-07 09:43
 * @Description:死锁测试
 */
public class DeadLockTest {
	public static void main(String[] args) {
		OtherService otherService = new OtherService();
		DeadLock deadLock = new DeadLock(otherService);
		otherService.setDeadLock(deadLock);

		new Thread() {
			@Override
			public void run() {
				while (true) {
					deadLock.m1();
				}
			}
		}.start();

		new Thread() {
			@Override
			public void run() {
				while (true) {
					otherService.s2();
				}
			}
		}.start();

	}
}
